]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
NetworkMenu: show devices that are unmanaged
authorGiovanni Campagna <gcampagna@src.gnome.org>
Mon, 9 May 2011 14:15:03 +0000 (16:15 +0200)
committerGiovanni Campagna <gcampagna@src.gnome.org>
Mon, 23 May 2011 17:11:35 +0000 (19:11 +0200)
Some users are confused when their devices are not shown in the
network menu, even if they configured them manually. Mark their presence
by showing them in the menu, even if they cannot be otherwise
interacted with.
Also add a status string for deactivating devices (none currently,
soon will appear in NetworkManager).

https://bugzilla.gnome.org/show_bug.cgi?id=646946

js/ui/status/network.js

index 3617c2b101de0b33e8bbff0130f783342eac7e8f..c8c2efc365fc7e78b10d14db2945a69c3cec186d 100644 (file)
@@ -526,11 +526,15 @@ NMDevice.prototype = {
 
     getStatusLabel: function() {
         switch(this.device.state) {
-        case NetworkManager.DeviceState.UNMANAGED:
         case NetworkManager.DeviceState.DISCONNECTED:
-        case NetworkManager.DeviceState.DEACTIVATING:
         case NetworkManager.DeviceState.ACTIVATED:
             return null;
+        case NetworkManager.DeviceState.UNMANAGED:
+            /* Translators: this is for network devices that are physically present but are not
+               under NetworkManager's control (and thus cannot be used in the menu) */
+            return _("unmanaged");
+        case NetworkManager.DeviceState.DEACTIVATING:
+            return _("disconnecting...");
         case NetworkManager.DeviceState.PREPARE:
         case NetworkManager.DeviceState.CONFIG:
         case NetworkManager.DeviceState.IP_CONFIG:
@@ -1691,21 +1695,18 @@ NMApplet.prototype = {
 
     _syncSectionTitle: function(category) {
         let devices = this._devices[category].devices;
-        let managedDevices = devices.filter(function(dev) {
-            return dev.device.state != NetworkManager.DeviceState.UNMANAGED;
-        });
         let item = this._devices[category].item;
         let section = this._devices[category].section;
-        if (managedDevices.length == 0)
+        if (devices.length == 0)
             section.actor.hide();
         else {
             section.actor.show();
-            if (managedDevices.length == 1) {
-                let dev = managedDevices[0];
+            if (devices.length == 1) {
+                let dev = devices[0];
                 dev.statusItem.actor.hide();
                 item.updateForDevice(dev);
             } else {
-                managedDevices.forEach(function(dev) {
+                devices.forEach(function(dev) {
                     dev.statusItem.actor.show();
                 });
                 // remove status text from the section title item